*****
*****	CCES analysis
*****
*****	description: this file analyses the vote validation and depression
*****	diagnosis variables as a replication for the JHPPL 2018 paper.
*****
*****
*****	last updated: 2/07/18
*****
*****	updated by: cjo
*****
*****
*****

cd "/Users/ojeda/Dropbox/Papers/JHPPL 2018/Data/CCES2012/"
/*
insheet using "cces_vv.csv", clear
save "cces_vv.dta", replace
*/

use "cces_vv.dta", clear

********************************************************************************
**** Section 1: Data Prep

** Vote
gen voter = 1 if e2012g != "MatchedNoVote" & e2012g != ""
replace voter = 0 if e2012g == "MatchedNoVote" | e2012g == ""

gen voter2 = 1 if e2012g != "MatchedNoVote" & e2012g != ""
replace voter2 = 0 if e2012g == "MatchedNoVote"

gen voter3 = 1 if e2012g != "MatchedNoVote" & e2012g != ""
replace voter3 = 0 if e2012g == "MatchedNoVote"
replace voter3 = 0 if catalist_match == "0" & votereg_post == 2
replace voter3 = 0 if catalist_match == "0" & cc401 < 5
 
gen vote_sr = 0
replace vote_sr = 1 if cc401 == 5
replace vote_sr = . if cc401 == 8 | cc401 == 9 | cc401 == .
replace vote_sr = 0 if votereg_post == 2
  
** Depression
tab cc326_7
gen depression = .
replace depression = 1 if cc326_7 == "1"
replace depression = 0 if cc326_7 == "2"
replace depression = 1 if cc326_7 == "Charles E. Schumer"

** Race
gen black = 0
replace black = 1 if race == 2
replace black = . if race == .

gen white = 0
replace white = 1 if race == 1
replace white = . if race == .

** Gender
gen female = 0
replace female = 1 if gender == 2
replace female = . if gender == .

** Intersectional categories
gen inter_cat = .
replace inter_cat = 1 if white == 1 & female == 0
replace inter_cat = 2 if white == 1 & female == 1
replace inter_cat = 3 if black == 1 & female == 0
replace inter_cat = 4 if black == 1 & female == 1

** Age
gen age = 2012 - birthyr

** Education
gen educ_degree = educ
replace educ_degree = . if educ == 8 | educ == 9

** Income
gen inc_cat = faminc
replace inc_cat = . if faminc == 97 | faminc == 98 | faminc == 99

** Church attendance
tab pew_churatd
gen attend = pew_churatd
replace attend = . if pew_churatd == 7 | pew_churatd == 8 | pew_churatd == 9
recode attend 6=1 5=2 4=3 3=4 2=5 1=6

** Marital status
gen married = 0
replace married = 1 if marstat == 1
replace married = . if marstat == 8 | marstat == 9

** Partisan strength
gen party_strength = .
replace party_strength = 0 if pid7 == 4
replace party_strength = 1 if pid7 == 3 | pid7 == 5
replace party_strength = 2 if pid7 == 2 | pid7 == 6
replace party_strength = 3 if pid7 == 1 | pid7 == 7

** Self-reported health status
gen health = genhealth
replace health = . if genhealth == 8 | genhealth == 9
recode health 5=1 4=2 3=3 2=4 1=5

** Health insurance
gen health_ins = healthins_6
recode health_ins 2=0

** Group consciousness
*Not available (as far as I can tell)

********************************************************************************
**** Section 2: Analyses


* Table A.20
tab inter_cat, sum(depression)
tab inter_cat, sum(vote_sr)
tab inter_cat, sum(voter)
tab inter_cat, sum(voter2)
tab inter_cat, sum(voter3)

* Table A.21
logit vote_sr depression
logit voter depression
logit voter2 depression
logit voter3 depression

logit vote_sr depression female black
logit voter depression female black
logit voter2 depression female black
logit voter3 depression female black

logit vote_sr depression female black age educ_degree inc_cat attend married party_strength health health_ins
logit voter depression female black age educ_degree inc_cat attend married party_strength health health_ins
logit voter2 depression female black age educ_degree inc_cat attend married party_strength health health_ins
logit voter3 depression female black age educ_degree inc_cat attend married party_strength health health_ins
